import requestProxy from '@/utils/request';
const { request } = requestProxy;

// 借款申请列表顶部tab
export function getLoanTab(params) {
  return request({
    url: 'admin/loan/tab',
    method: 'get',
    params
  });
}
// 借款申请列表统计数据
export function getLoanStatistics(params) {
  return request({
    url: 'admin/loan/list/statistics',
    method: 'get',
    params
  });
}
// 借款申请列表
export function getLoanList(params) {
  return request({
    url: 'admin/loan/list',
    method: 'get',
    params
  });
}
// 借款申请详情
export function getLoanDetail(params) {
  return request({
    url: `admin/loan/detail/${params.id}`,
    method: 'get'
  });
}
// 评论列表
export function getLoanComments(params) {
  return request({
    url: '/admin/loan/comments/list',
    method: 'get',
    params
  });
}
// 发表评论
export function addLoanComment(data) {
  return request({
    url: '/admin/loan/comments/add',
    method: 'post',
    data
  });
}
// 借款申请 - 流程 - 撤销
export function revokeLoanProcess(data) {
  return request({
    url: '/admin/loan/process/revocation',
    method: 'post',
    data
  });
}
// 借款申请 - 流程 - 撤回
export function recallLoanProcess(data) {
  return request({
    url: '/admin/loan/process/recall',
    method: 'post',
    data
  });
}
// 借款申请-流程审批
export function auditLoanProcess(data) {
  return request({
    url: '/admin/loan/process/audit',
    method: 'post',
    data
  });
}
// 编辑借款说明
export function editLoanRemark(params) {
  return request({
    url: 'admin/loan/remarkEdit',
    method: 'put',
    params
  });
}
export function createLoan(data) {
  return request({
    url: 'admin/loan/create',
    method: 'post',
    data
  });
}
export function editLoan(id, data) {
  return request({
    url: `admin/loan/edit/${id}`,
    method: 'put',
    data
  });
}
export function submitLoanForm(data) {
  return request({
    url: 'admin/loan/formSubmit',
    method: 'post',
    data
  });
}
// 删除借款列表元素
export function deleteLoan(id) {
  return request({
    url: `/admin/loan/delete/${id}`,
    method: 'delete'
  });
}

// 获取个人历史填写收款账户
export function getHistoryAccounts(params) {
  return request({
    url: 'admin/personalAccountsReceivable/list',
    method: 'get',
    params
  });
}
// 删除个人历史填写收款账户
export function deleteAccount(id) {
  return request({
    url: `/admin/personalAccountsReceivable/delete/${id}`,
    method: 'delete'
  });
}
